@isTest
private class CalculateStageWinRateTest {
    
    static testMethod void testCalculateStageWinRate() {
        Account acc = TestUtils.createAccount();
        insert acc;

        Opportunity opp = TestUtils.createOpportunity();
        opp.AccountId = acc.Id;
        insert opp;

        // 第一次
        CalculateStageWinRate cal = new CalculateStageWinRate(new ApexPages.StandardController(opp));

        cal.cWList[0].isChoosed = true;
        cal.cWList[0].wrt.SupportRatio__c = 50;
        cal.cWList[0].wrt.Weight__c = 80;
        cal.NewStageWinRate();

        // 第二次
        cal = new CalculateStageWinRate(new ApexPages.StandardController(opp));
        cal.cWList[1].isChoosed = true;
        cal.cWList[1].wrt.SupportRatio__c = 50;
        cal.cWList[1].wrt.Weight__c = 80;
        cal.NewStageWinRate();
    }
}